package d14_homework.homework03;

import java.util.Scanner;

//import static d14_homework.homework03.Fee.CHARGE_TYPE_CHARGED;

public class Test {
    public static void main(String[] args) {

        // 创建扫描器
        Scanner sc = new Scanner(System.in);
        //提示用户输入付款方式标码
        System.out.println("请输入对应的付款方式标号");
        String sign = sc.next();
        //调用方法进行优化
        System.out.println(getTypeBySign(sign));
    }
    //独立功能独立成方法

/*    public static String showFeeType(Fee flag){
        // 创建扫描器
        Scanner sc = new Scanner(System.in);
        //提示用户输入付款方式标码
        System.out.println("请输入对应的付款方式标号");
        String sign = sc.next();
*//*
        //进行switch判断
        switch(sign){
            case


        }*//*
        return null;
    }*/
    public static String getTypeBySign(String sign){
        Fee[] values = Fee.values();
        for (int i = 0; i < values.length; i++) {
            String okSign = values[i].getSign();
            if (okSign.equals(sign)){
                return values[i].getType();
            }
        }
        return "未知付款类型";
    }
}
